Music Object Extension - Debug

  Contents

About This Extension

This extension is designed to assist one in tracking down errors in sonification code. The features offered in this extension were built directly into the "music-object.js" file in Music Object versions earlier than 3.2.0. In the interest of reducing the size of the core Music Object API, these features were moved out of the core.

Since debugging and error catching are typically only useful when developing code, it is assumed they will not be needed once the sonified Web content is finalized and ready to go live. So, one can source in this extension during the development phase for the sonified content and then remove the links once the content is final and fully functional. Music Object versions 3.2.0 and higher still do basic error catching to help prevent users from seeing errors that may result from them interrupting the loading of sonified pages with JavaScript code, but one cannot customize ways of displaying error messages unless this extension is used.

For further information on debugging sonified content, consult the section Debugging Aids.

Browser Limitations

The Debug extension does not perform error handling for Microsoft Internet Explorer or Netscape 6, because of limitations in these browsers.

What's New in the Latest Version

There is a dedicated version history for this extension, where you will be able to find out about the new features and possible issues with the most recent version. The version history for this extension is independent of the version history for the core Music Object API.

Getting This Extension

To get the "music-object-x-debug.js" JavaScript file that implements this extension, simply right-click on this link (click-and-hold for Mac users). Then, from the menu that pops up, select the 'Save Link As...' or 'Save Target As...' option and save the file as "music-object-x-debug.js" into an appropriate folder of the local copy of your Web site.

In case you have problems saving the file using the above link, the "music-object-x-debug.js" file can also be found inside the documentation's "javascript" folder, along with the "music-object.js" file.

Dependencies

In order to use this extension, the following JavaScript file(s) must first be sourced in...

For more information on using extensions, consult the section About Music Object Extensions.

Reference

 Name   Short Description 
Static Methods
Music.debugMessage Lets you send a message to the currently configured debug output.
Static Properties
Music.debugToAlert A boolean, specifying whether or not error messages are to be displayed in alert boxes.
Music.debugToJavaConsole A boolean, specifying whether or not error messages are to be displayed in the Java console.
Music.debugToStatus A boolean, specifying whether or not error messages are to be displayed in the window's status bar.

Static Methods

 Music.debugMessage

 
 CATEGORY   Static Method 
 MODULE   Music Object Extension - Debug 
 Min. Player Version   n/a 
 

The Music.debugMessage static method lets you send a message to the currently configured debug output.

SYNTAX    Music.debugMessage ( DebugMessageSTR )

The Music.debugMessage method lets you send a message to the currently selected debug output (alert dialog, Java console, and window status bar). Debug output options are set using the static properties Music.debugToAlert, Music.debugToJavaConsole, and Music.debugToStatus.

In the following example, each time the function "refreshVolumeSlider" is called a message showing the volume update value will be displayed in the Java console. This kind of message is useful when trying to track down problems in the logic or order of execution of one's code.

<SCRIPT SRC="music-object.js"></SCRIPT>
<SCRIPT SRC="music-object-x-debug.js"></SCRIPT>

<SCRIPT LANGUAGE=JavaScript><!-- //

   Music.debugToJavaConsole = true;
   Music.debugToAlert = false;
   Music.debugToStatus = true;

   function updateVolumeSlider (newVolumeLevel) {
      Music.debugMessage ('new value for slider = ' + newVolumeLevel);
      // code to update the volume slider
   }

// --></SCRIPT>

Static Properties

 Music.debugToAlert

 
 CATEGORY   Static Property 
 MODULE   Music Object Extension - Debug 
 Type   boolean 
 Default Value   false 
 Access   read / write 
 

The Music.debugToAlert property is a boolean variable, specifying whether or not error messages are to be displayed in alert boxes. When set to false, errors will not be reported in alert boxes. And when set to true, errors will be reported in alert boxes.

For comprehensive guidelines on how to use this property in conjunction with the other debugging properties, see the section Music Object Debugging Aids.

 Music.debugToJavaConsole

 
 CATEGORY   Static Property 
 MODULE   Music Object Extension - Debug 
 Type   boolean 
 Default Value   true 
 Access   read / write 
 

The Music.debugToJavaConsole property is a boolean variable, specifying whether or not error messages are to be displayed in the Java console. When set to false, errors will not be reported in the Java console. And when set to true, errors will be reported in the Java console. Error messages can only be reported to the Java console when using Netscape Navigator, so this property will simply be ignored for Microsoft Internet Explorer and other browsers that do not provide a Java console.

For comprehensive guidelines on how to use this property in conjunction with the other debugging properties, see the section Music Object Debugging Aids.

 Music.debugToStatus

 
 CATEGORY   Static Property 
 MODULE   Music Object Extension - Debug 
 Type   boolean 
 Default Value   true 
 Access   read / write 
 

The Music.debugToStatus property is a boolean variable, specifying whether or not error messages are to be displayed in the window's status bar. When set to false, errors will not be reported in the window's status bar. And when set to true, errors will be reported in the window's status bar.

For comprehensive guidelines on how to use this property in conjunction with the other debugging properties, see the section Music Object Debugging Aids.